]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageTray: Drop NotificationBanner
authorJulian Sparber <julian@sparber.net>
Mon, 12 Feb 2024 12:07:37 +0000 (13:07 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 3 Mar 2024 01:33:16 +0000 (01:33 +0000)
We want to have the same widget used to display the notification in the
calendar popover as in the messageTray, so let's actually use the same
widget.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3173>

js/ui/messageTray.js

index 823b7b9ab2fe7266c575aac4fd552e7555f07fd0..a8732e6e07de60202bcd6432aa8910640f3a8a2c 100644 (file)
@@ -575,27 +575,6 @@ export const Notification = GObject.registerClass({
 });
 SignalTracker.registerDestroyableType(Notification);
 
-export const NotificationBanner = GObject.registerClass({
-    Signals: {
-        'done-displaying': {},
-    },
-}, class NotificationBanner extends Calendar.NotificationMessage {
-    _init(notification) {
-        super._init(notification);
-
-        this.can_focus = false;
-        this.add_style_class_name('notification-banner');
-
-        this.notification.connectObject('activated', () => {
-            // We hide all types of notifications once the user clicks on
-            // them because the common outcome of clicking should be the
-            // relevant window being brought forward and the user's
-            // attention switching to the window.
-            this.emit('done-displaying');
-        }, this);
-    }
-});
-
 export const Source = GObject.registerClass({
     Properties: {
         'count': GObject.ParamSpec.int(
@@ -931,6 +910,7 @@ export const MessageTray = GObject.registerClass({
             this._notificationRemoved = true;
             if (this._notificationState === State.SHOWN ||
                 this._notificationState === State.SHOWING) {
+                this._pointerInNotification = false;
                 this._updateNotificationTimeout(0);
                 this._updateState();
             }
@@ -1059,12 +1039,6 @@ export const MessageTray = GObject.registerClass({
         return GLib.SOURCE_REMOVE;
     }
 
-    _escapeTray() {
-        this._pointerInNotification = false;
-        this._updateNotificationTimeout(0);
-        this._updateState();
-    }
-
     // All of the logic for what happens when occurs here; the various
     // event handlers merely update variables such as
     // 'this._pointerInNotification', 'this._traySummoned', etc, and
@@ -1147,8 +1121,9 @@ export const MessageTray = GObject.registerClass({
             this.idleMonitor.add_user_active_watch(this._onIdleMonitorBecameActive.bind(this));
         }
 
-        this._banner = new NotificationBanner(this._notification);
-        this._banner.connectObject('done-displaying', this._escapeTray.bind(this), this);
+        this._banner = new Calendar.NotificationMessage(this._notification);
+        this._banner.can_focus = false;
+        this._banner.add_style_class_name('notification-banner');
 
         this._bannerBin.add_child(this._banner);